#include<bits/stdc++.h>
using namespace std;
const int maxn=8010;
inline int read(){
	register int x=0;
	register char c=getchar();
	for(;!(c>='0'&&c<='9');c=getchar());
	for(;c>='0'&&c<='9';c=getchar())
		x=(x<<1)+(x<<3)+c-'0';
	return x;
}
vector<pair<int,int> >v;
int a[maxn];
int n,m;
int Find(int w,int x){
	register int l=0,r=n-1,mid;
	while(r>l){
		mid=l+r+1>>1;
		if(v[mid].first>w||(v[mid].first==w&&v[mid].second>x)) r=mid-1;
		else l=mid;
	}
	return l;
}
int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	n=read(),m=read();
	for(register int i=1;i<=n;i++)
		a[i]=read(),v.insert(upper_bound(v.begin(),v.end(),make_pair(a[i],i)),make_pair(a[i],i));
	register int opt,x,y,ii;
	while(m--){
		opt=read();
		if(opt==1){
			x=read(),y=read();
			v.erase(v.begin()+Find(a[x],x)),a[x]=y;
			v.insert(upper_bound(v.begin(),v.end(),make_pair(a[x],x)),make_pair(a[x],x));
		}
		else x=read(),printf("%d\n",Find(a[x],x)+1);
	}
	return 0;
}//henghenghengaaaaaaaaaaaaaaa
